Skip to content

Explain why the Web Debug Toolbar is gone #8934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 5, 2018

Conversation

marcelkorpel
Copy link
Contributor

When rendering a response using a template, the Web Debug Toolbar is gone, which was confusing to me. Only after searching I found the reason: there is no body element when using this rendering method. It seems logical to me to also explain extending a template to incorporate base.html.twig, so the Toolbar re-appears.

When rendering a response using a template, the Web Debug Toolbar is gone, which was confusing to me. Only after searching I found the reason: there is no body element when using this rendering method. It seems logical to me to also explain extending a template to incorporate base.html.twig, so the Toolbar re-appears.
@@ -262,6 +262,20 @@ to get your *new* lucky number!

http://localhost:8000/lucky/number

Now you may wonder where the Web Debug Toolbar has gone: that's because we don't write
a ``body`` element using the current template. If we incorporate the default
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a body element -> a <body> HTML tag ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, though, strictly speaking, a tag is not an element, and I guess the element should be present, not only an opening tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, only </body> have to be present. Not even a complete body element.

Strictly speaking there is a body element (The node in a DOM tree), which consists of an open and close tag.

In any case, let's be explict here and say "that's because there is no </body> tag in the current template. You can add the body element yourself, or extend base.html.twig, which contains all default HTML elements." (also removing first person usage)

If you agree, can you please update your PR (otherwise, just comment back)? Thanks!

@javiereguiluz
Copy link
Member

Even if this fix is correct, I'd love to fix this differently. The fact that the debug toolbar needs a </body> tag to be injected should be a very minor internal detail. Could we add a <body> tag to the original contents so the toolbar is always visible? Any other way to fix this?

@marcelkorpel
Copy link
Contributor Author

In that case I'd simply copy the base template, so you at least create a valid HTML page. I don't know about another solution, but I'm also just learning Symfony.

@wouterj
Copy link
Member

wouterj commented Dec 31, 2017

Looks good! (except from the minor issue that we add line breaks after the first word crossing the 72th character, but we can fix it during the merge)

👍 Thanks!

status: reviewed

@javiereguiluz
Copy link
Member

@marcelkorpel thanks for this improvement and congrats on your first Symfony Docs contribution!

@javiereguiluz javiereguiluz merged commit b1cf487 into symfony:4.0 Jan 5, 2018
javiereguiluz added a commit that referenced this pull request Jan 5, 2018
…javiereguiluz)

This PR was merged into the 4.0 branch.

Discussion
----------

Explain why the Web Debug Toolbar is gone

When rendering a response using a template, the Web Debug Toolbar is gone, which was confusing to me. Only after searching I found the reason: there is no body element when using this rendering method. It seems logical to me to also explain extending a template to incorporate base.html.twig, so the Toolbar re-appears.

Commits
-------

b1cf487 Wrap long lines
0c272c3 Reword explanation
1c25c7c Explain why the Web Debug Toolbar is gone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants